package me.zingon.self.bigdispatcher.entity;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * (NacosJobDetail)实体类
 *
 * @author zingon
 * @since 2020-12-30 10:35:22
 */
@Data
public class NacosJob implements Serializable {
    private static final long serialVersionUID = -74118743646759311L;

    @TableId(type = IdType.AUTO)
    private Long id;

    private String namespaceId;

    private String groupName;

    private String serviceName;

    private String path;

    private String params;

    private String method;

    private String cron;

    private String description;

    private Integer status;

    private Integer count;

    private Date createTime;

    private Date updateTime;

    private Integer isDelete;

    @TableField(exist = false)
    private Map<String, Object> paramsM;

    public void setParams(String params) {
        this.params = params;
        if (JSONUtil.isJsonObj(params)) {
            this.paramsM = JSONUtil.parseObj(params);
        }
    }

}